package ExtendDemo.demo05;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.Socket;
import java.nio.charset.StandardCharsets;

public class ClientDemo {
    public static void main(String[] args) throws IOException {
        Socket s=new Socket("192.168.0.101",10000);
        OutputStream os = s.getOutputStream();
        os.write("hello,tcp,我来了".getBytes(StandardCharsets.UTF_8));

        InputStream is = s.getInputStream();
        byte[]bytes=new byte[1024];
        int len=is.read(bytes);
        System.out.println("客户端"+new String(bytes,0,len));

        s.close();
    }
}
